############### notes:Read https://pymotw.com/2/select/
##############? TODO:change command parser to read entire dict with MODE
############## ? TODO make read_input work with the entire dict
#fine imports


import configurethis
import serverx

cfgmen = configurethis.Menu()
config = configurethis.Configit()


main_server = serverx.server()

main_server.create()
#load NPCS and some other stuff from DB that will run live? or load on maps?

while 1:
    while cfgmen.state == 0:
    
        cfgmen.display()
        cfgmen.ginput()

        if cfgmen.state == 2:
            #setport
            print("does nothing yet"+"/n")
            cfgmen.returntomenu()
        if cfgmen.state == 3:
            #set db pass
            #config.setdbpass()
            print("does nothing yet"+"/n")
            cfgmen.returntomenu()
        if cfgmen.state == 4:
            #set db user
            print("does nothing yet"+"/n")
            cfgmen.returntomenu()
        if cfgmen.state == 999:
            quit()
    

    if cfgmen.state == 1:


        main_server.process()
        main_server.debug_commander()
        main_server.process_mob()
        main_server.process_all_chat()
        main_server.process_commands()
        #main_server.process_events()

        #main_server.process_maps()
